package spring.cloud.eurekaclientproduct.cmd;

import com.netflix.hystrix.HystrixCommand;
import com.netflix.hystrix.HystrixCommandGroupKey;
import org.springframework.web.client.RestTemplate;
import com.spring.cloud.commonutils.vo.UserInfo;
import com.spring.cloud.commonutils.vo.ResultMessage;

public class UserTimeoutCommand extends HystrixCommand<ResultMessage> {

    private RestTemplate restTemplate;

    public UserTimeoutCommand(Setter setter,RestTemplate restTemplate) {
        super(setter);
        this.restTemplate = restTemplate;
    }

    @Override
    protected ResultMessage run() throws Exception {
        String url = "http://eureka-client-user/hystrix/timeout";
        return restTemplate.getForObject(url,ResultMessage.class);
    }

    @Override
    public ResultMessage getFallback() {

        return new ResultMessage(false,"超时le");
    }
}
